<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			.msg_error{
				color: red;
			}
		</style>
	</head>
	<body>
		<div id = "login">
			<div>
				<input type="text" id="login_account" name="" placeholder="账号"/>
				<span id="msg_account_error" class="msg_error" style="display: none;">请输入账号</span>
			</div>
			<div>
				<input id="login_password" name="" placeholder="密码"/>
				<span id="msg_password_error" class="msg_error" style="display: none;">请输入密码</span>
			</div>
		</div>
		<div id="login_button">
			<button onclick="CheckLogin()">登录</button>
		</div>
	</body>
</html>
<script>
	function CheckLogin(){
		document.getElementById("msg_account_error").style.display="none";
		document.getElementById("msg_password_error").style.display="none";
		var login_account = document.getElementById("login_account").value;
		var login_password = document.getElementById("login_password").value;
		if(login_account == ""){
			document.getElementById("msg_account_error").style.display="";
			document.getElementById("login_account").focus();
			return;
		}
		else if(login_password == ""){
			document.getElementById("msg_password_error").style.display="";
			document.getElementById("login_password").focus();
			return;
		}
		else
			alert("登录成功");
	}
</script>
